#include "widget.h"
#include "ui_widget.h"

Helper::Helper(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    journal=new Journal(this);
    schedule=new ItemWidget(this,TD_JOURNAL,CAT_SCHEDULE);
    memo=new ItemWidget(this,TD_JOURNAL,CAT_MEMO);
    remind=new Remind(this);

    assembleFlow=nullptr;
    assembleLog=nullptr;
    purchaseLog=nullptr;
    feedback=nullptr;
    expressTrack=nullptr;

    ui->tabWidget->addTab(journal,CAT_JOURNAL);
    ui->tabWidget->addTab(schedule,CAT_SCHEDULE);
    ui->tabWidget->addTab(memo,CAT_MEMO);
    ui->tabWidget->addTab(remind,CAT_REMIND);
}

Helper::~Helper()
{
    delete ui;
}

void Helper::closeEvent(QCloseEvent *)
{
    showMinimized();
}

void Helper::on_btn_assembleFlow_clicked()
{
    if(assembleFlow == nullptr)
        assembleFlow=new AssembleFlow;
    assembleFlow->show();
}

void Helper::on_btn_assembleLog_clicked()
{
    if(assembleLog == nullptr)
        assembleLog=new AssembleLog;
    assembleLog->show();
}

void Helper::on_btn_pruchaseLog_clicked()
{
    if(purchaseLog == nullptr)
        purchaseLog=new PurchaseLog;
    purchaseLog->show();
}

void Helper::on_btn_feedback_clicked()
{
    if(feedback==nullptr)
        feedback=new Feedback;
    feedback->show();
}

void Helper::on_btn_track_clicked()
{
    if(expressTrack==nullptr)
        expressTrack=new ExpressTrack;
    expressTrack->show();
}
